<template>
    <view class="main-contanier">
        <uni-easyinput v-model="formData.nick" placeholder="请输入内容"></uni-easyinput>

        <view class="btn-wrap">
            <text class="btn" @click="handlerSave">保 存</text>
        </view>
    </view>
</template>

<script setup lang="ts">
import { reactive } from "vue"

import { useUserStore } from '@/stores'

// 用户存储
const userStore = useUserStore()

const formData = reactive({
	nick: userStore.profile.user.nick
})

// 保存数据
const handlerSave = async () => {
    await userStore.modifyNick(formData)
    uni.showToast({
        title: '修改成功',
        duration: 1000
    })
}
</script>

<style lang="scss">
.main-contanier {
    padding: 10rpx;
    .btn-wrap {
        padding-top: 20rpx;
        display: flex;
        justify-content: center;
        .btn {
            display: block;
            width: 700rpx;
            height: 70rpx;
            line-height: 70rpx;
            border-radius: 35rpx;
            color: #fff;
            text-align: center;
            background-color: #008000;
        }
    }
}
</style>